// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class sample125 : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        sourceCode.Text = @"public void LinqToEntities93()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;decimal x = 100;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;var query = context.Orders.Where(o => o.Freight > x).Select(o => new { o.Freight, o });<br><br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(x);<br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(query);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;x = 200;<br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(x);<br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(query);<br>}<br>";
    }

    public void ExecuteQuery(object src, EventArgs e)
    {
        using (context = new EntityNorthwind.EntityNorthwindContext(connstr))
        {
            LinqToEntities93();
        }
        this.output.Text = QueryOutput();
    }

	public void LinqToEntities93()
{
    decimal x = 100;

    var query = context.Orders.Where(o => o.Freight > x).Select(o => new { o.Freight, o });

    ObjectDumper.Write(x);
    ObjectDumper.Write(query);

    x = 200;
    ObjectDumper.Write(x);
    ObjectDumper.Write(query);
}

}
